package com.backend.demo.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.backend.demo.dao.UserDao;
import com.backend.demo.entities.Users;
import com.backend.demo.service.IUserService;

/**
 * 用户功能的实现类
 * @author Administrator
 *
 */
@Service("userService")
public class UserServiceImpl implements IUserService {

	@Resource(name="userDao")
	private UserDao userDao;
	
	@Override
	public Users userLogin(String userName, String userPassword) {
		return userDao.userLogin(userName, userPassword);
	}

	@Override
	public int logout(String loginStatus, Long userID) {
		return userDao.logout(loginStatus, userID);
	}

	@Override
	public int editUserMsg(Users users) {
		return userDao.editUserMsg(users);
	}

	@Override
	public List<Users> getAllUsers() {
		return userDao.getAllUsers();
	}

	@Override
	public List<Users> getAllUsersByCondition(Users user) {
		return userDao.getUserByCondition(user);
	}

	@Override
	public int addUser(Users user) {
		return userDao.addUsers(user);
	}

	@Override
	public Users getUsersById(long userID) {
		return userDao.getUsersById(userID);
	}

	@Override
	public int deleteById(long userID) {
		return userDao.deleteById(userID);
	}

	@Override
	public int resetPassword(String userName, String password) {
		return userDao.modifyPassword(userName, password);
	}

	@Override
	public boolean validateUserNameIsUnique(String userName, String nickname) {
		return userDao.validateUserNameIsUnique(userName, nickname);
	}
}
